﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataAccessLayer;

namespace BusinessLogicLayer
{
    public class TinhHieuSuatCV
    {
        public float TinhHieuSuatTuan(int _magv)
        {
            CT_GiaoViecBLL ctgvBLL = new CT_GiaoViecBLL();
            List<CT_GIAOVIEC> _ls = ctgvBLL.LayDSCTGiaoViec(_magv);

            float hsCV = 0;
            float toghs = 0;

            foreach (var i in _ls)
            {
                toghs += (float)i.HeSo;
                hsCV += ((float)i.KetQua / (float)i.ChiTieu) * (float)i.HeSo;
            }

            float hs = (hsCV / toghs) * 100;

            return hs;
        }
    }
}
